﻿using System;
using System.Collections.Generic;
using BusinessObjects;
using BusinessObjects.BusinessRules;

namespace BusinessSecurity
{
    /// <summary>
    ///     Permission
    /// </summary>
    public class Permission : BusinessObject
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="Permission" /> class.
        /// </summary>
        public Permission()
        {
            AddRule(new ValidateId("Id"));
            AddRule(new ValidateLength("Title", 0, 255));
            AddRule(new ValidateLength("Code", 0, 255));
        }

        /// <summary>
        ///     Initializes a new instance of the <see cref="Permission" /> class.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="title">The title.</param>
        /// <param name="code">The code.</param>
        /// <param name="description">The description.</param>
        /// <param name="order">The order.</param>
        /// <param name="status">
        ///     if set to <c>true</c> [status].
        /// </param>
        public Permission(int id, string title, string code, string description, int order, bool status)
        {
            Id = id;
            Title = title;
            Code = code;
            Description = description;
            Order = order;
            Status = status;
        }

        /// <summary>
        ///     Gets or sets the identifier.
        /// </summary>
        /// <value>
        ///     The identifier.
        /// </value>
        public int Id { get; set; }

        /// <summary>
        ///     Gets or sets the title.
        /// </summary>
        /// <value>
        ///     The title.
        /// </value>
        public string Title { get; set; }

        /// <summary>
        ///     Gets or sets the code.
        /// </summary>
        /// <value>
        ///     The code.
        /// </value>
        public string Code { get; set; }

        /// <summary>
        ///     Gets or sets the description.
        /// </summary>
        /// <value>
        ///     The description.
        /// </value>
        public string Description { get; set; }

        /// <summary>
        ///     Gets or sets the order.
        /// </summary>
        /// <value>
        ///     The order.
        /// </value>
        public int Order { get; set; }

        /// <summary>
        ///     Gets or sets a value indicating whether [status].
        /// </summary>
        /// <value>
        ///     <c>true</c> if [status]; otherwise, <c>false</c>.
        /// </value>
        public bool Status { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [show default].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [show default]; otherwise, <c>false</c>.
        /// </value>
        public bool ShowDefault { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [has image].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [has image]; otherwise, <c>false</c>.
        /// </value>
        public bool HasImage { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [multi row].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [multi row]; otherwise, <c>false</c>.
        /// </value>
        public bool MultiRow { get; set; }

        /// <summary>
        /// Gets or sets the modified date.
        /// </summary>
        /// <value>
        /// The modified date.
        /// </value>
        public DateTime ModifiedDate { get; set; }

        /// <summary>
        ///     Gets or sets the permission in sites.
        /// </summary>
        /// <value>
        ///     The permission in sites.
        /// </value>
        public List<PermissionInSite> PermissionInSites { get; set; }
    }
}